package com.nifostasky.comic.vos;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @Author WuYuanBo qq:9976797
 * @Date 2021/6/3 17:39
 * @Version 1.0
 */
@Data
@ApiModel(description = "分页返回结果")
public class PageResult<T> {

    @ApiModelProperty("总记录数")
    private Long total;

    @ApiModelProperty("结果")
    private List<T> data;

    public PageResult(Long total, List<T> data) {
        this.total = total;
        this.data = data;
    }

    public PageResult(IPage<T> page) {
        this.total = page.getTotal();
        this.data = page.getRecords();
    }
}
